#pragma once
#include<QString>
#include<QMap>
#include<memory>
//#include "include/Parameter/BVParamNameDef.h"
//#include "include/Database/CaptureParam.h"
//#include "include/Database/DefaultParam.h"
//#include "include/BVManageTool/Parameter/BVParamDefaultDef.h"
class DefaultParam;
class CaptureParam;
using DefaultParamMap = QMap<QString, DefaultParam*>;
typedef int TypeId;
using CaptureParamMap = QMap<TypeId, CaptureParam*>;
class QSettings;
class BVParamReader
{
private:
	BVParamReader();
	~BVParamReader() {}

private:
	DefaultParamMap _defaultParams;
	CaptureParamMap _captureParams;
	QString _errorMsg;

	CaptureParam* getCaptureParam(int TypeId);

private:
	static BVParamReader* _instance;
	std::shared_ptr<QSettings> _settings;
public:
	static BVParamReader* getInstance();
	QString getErrorMsg()const;
	void setErrorMsg(const QString&text);
	bool readFromDb();
	QString getSoftwareConfigValue(const QString& key);
	QString getRegisterValue(const QString& key);
	QString getDefaultValue(const QString& key);

	bool initScanParam();



	int getTpye(TypeId id);
	double getAxisFastEnd(TypeId ID);
	double getAxisFastBegin(TypeId ID);
	double getAxisSlowEnd(TypeId ID);
	double getAxisSlowBegin(TypeId ID);
	int getSignalTrigger(TypeId ID);
	int getScanDirection(TypeId ID);
	double getCycle(TypeId ID);
	double getVoltage(TypeId ID);
	double getExposure(TypeId ID);
	double getLinePeriod(TypeId ID);
	double getGain(TypeId ID);
	double getPreampGain(TypeId ID);

	int getCaptureLineNumber(TypeId ID);
	int getFrameTriggerNumber(TypeId ID);
	double getVerticalAxisFastEnd(TypeId ID);
	double getVerticalAxisFastBegin(TypeId ID);
	double getVerticalAxisSlowEnd(TypeId ID);
	double getVerticalAxisSlowBegin(TypeId ID);


};

